package com.iot.ic.controller;

import com.iot.ic.base.BaseController;
import com.iot.ic.common.Response;
import com.iot.ic.model.Competition;
import com.iot.ic.service.CompetitionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 比赛回查   2017/7/11.
 */
@RestController
@Api(description = "赛事信息相关接口")
public class CompetitionController extends BaseController {

    @Autowired
    private CompetitionService competitionService;

    @ApiOperation(value = "获取赛事列表")
    @GetMapping(value = "/users/{userId}/competitions")
    public Response getAllCompetitions(@PathVariable("userId")int userId){
        Response response=new Response();
        List<Competition> list=competitionService.getCompetitionList();
        response.setResult(list);
        return  response;
    }


}
